﻿using System;

namespace 质数
{
    class Program
    {
        static void Main(string[] args)
        {
            int temp = 0;
            for (int i = 2; i <= 100000; i++)
            {
                for (int j = 2; j <= i; j++)
                {
                    if (i % j == 0 && i != j)
                    {
                        break;
                    }
                    if (i % j == 0 && i == j)
                    {
                        for (int k = 0; k < 5 - i.ToString().Length; k++)
                        {
                            Console.Write(" ");
                        }
                        Console.Write(i);
                        Console.Write(" ");
                        temp++;
                        if (temp % 8 == 0)
                        {
                            Console.WriteLine(" ");
                        }
                    }

                }
            }
                Console.WriteLine("");
                Console.WriteLine("输出的总数；{0}",temp);
                Console.ReadKey();
            }
           
        }
    }

